const getFormat = (date, format) => {
  let Y = date.getFullYear()
  let M = date.getMonth() + 1 >= 10 ? date.getMonth() + 1 : `0${date.getMonth()+1}`;
  let D = date.getDate() >= 10 ? date.getDate() : `0${date.getDate()}`
  let h = date.getHours() >= 10 ? date.getHours() : `0${date.getHours()}`;
  let m = date.getMinutes() >= 10 ? date.getMinutes() : `0${date.getMinutes()}`;
  if (format == 'yy-mm') {
    return `${Y}-${M}`
  } else if (format == 'yy') {
    return `${Y}`
  } else if (format == 'yy-mm-ss') {
    return `${Y}-${M}-${D}`
  } else if (format == 'yy-mm-ss-hh') {
    return `${Y}-${M}-${D} ${h}:${m}`
  } else {
    return `${Y}-${M}`
  }
}

export default getFormat